﻿using System.Collections.Generic;
using JetBrains.Annotations;
using Missbot.Core.Base;

namespace Missbot.AIModule.Vip.VipArmers
{
    [UsedImplicitly]
    public class 安妮的镜子 : IVipArmer
    {
        public string Name { get; set; } = "安妮的镜子";
        public string Description { get; set; } = "额外获得一个下次捞瓶子获得的物品的复制，最多同时持有1个，每天最多购买2次。";
        public int DiamondsNeed { get; set; } = 30;
        public VipArmerLimitInterval LimitInterval { get; set; }
        public int LimitCount { get; set; }

        public bool Purchase(InboxSession session)
        {
            var armer = new ArmerModel { Name = Name, Description = Description };

            var armerRec = VipArmerDA.Get(session.User.ID);
            if (armerRec == null)
            {
                armerRec = new VipArmerRecord { UserID = session.User.ID, Armers = new List<ArmerModel> { armer } };
                armerRec.Insert();
            }
            else
            {
                armerRec.Armers.Add(armer);
                armerRec.Update();
            }

            session.SendBack("购买成功！");
            return true;
        }

        public int MaxContains { get; set; } = 1;
    }
}